from pathlib import Path
import csv
import matplotlib.pyplot as plt
from datetime import datetime

path = Path('weather_data/sitka_weather_07-2021_simple.csv')
lines = path.read_text().splitlines()

reader = csv.reader(lines)
tt = next(reader)
# print(reader_row)
# for index,column_header in enumerate(reader_row):
#     print(index,column_header)
dates,highs=[],[]
for row in reader:
    current_date=datetime.strptime(row[2],'%Y-%m-%d')
    high=int(row[4])
    dates.append(current_date)
    highs.append(high)
# print(highs)
plt.style.use('bmh')
fig, ax = plt.subplots()
ax.plot(dates,highs,color='red')
ax.set_title("Daily High Temperature")
ax.set_xlabel("",fontsize=13)
fig.autofmt_xdate()
ax.set_ylabel("Temperature",fontsize=12)
ax.tick_params(labelsize=14)
plt.show()